/**
 * 
 */
package com.primestone.cim;

import static com.primestone.cim.util.StringUtil._NULL_BOOLEAN_;
import static com.primestone.cim.util.StringUtil._NULL_STRING_;

import java.util.List;

import ch.iec.tc57._2011.getmeterreadschedulesmessage.GetMeterReadSchedulesRequestType;
import ch.iec.tc57._2011.meterreadschedules.CustomerAccount;
import ch.iec.tc57._2011.meterreadschedules.CustomerAgreement;
import ch.iec.tc57._2011.meterreadschedules.EndDeviceAsset;
import ch.iec.tc57._2011.meterreadschedules.EndDeviceGroup;
import ch.iec.tc57._2011.meterreadschedules.MeterReadSchedules;
import ch.iec.tc57._2011.meterreadschedules.ReadingType;
import ch.iec.tc57._2011.meterreadschedules.TimeSchedule;
import ch.iec.tc57._2011.meterreadschedules.TimeSchedule.TimePoints;

import com.primestone.cim.util.DateUtil;
import com.primestone.cim.util.NumberUtil;

/**
 * @author cesar.mateus
 *
 */
public class Completer {	
	
	public static MeterReadSchedules fillMeterReadSchedules(GetMeterReadSchedulesRequestType request) {

		MeterReadSchedules meterReadSchedules = new MeterReadSchedules();

		fillCustomerAccountList(meterReadSchedules.getCustomerAccount());
		fillCustomerAgreementList(meterReadSchedules.getCustomerAgreement());
		fillEndDeviceAssetList(meterReadSchedules.getEndDeviceAsset());
		fillEndDeviceGroupList(meterReadSchedules.getEndDeviceGroup());
		fillReadingTypeList(meterReadSchedules.getReadingType());
		fillTimeScheduleList(meterReadSchedules.getTimeSchedule());

		return meterReadSchedules;
	}

	public static void fillCustomerAccountList(List<CustomerAccount> customerAccountList) {
		// TODO iterar sobre una lista de CustomerAccounts
		customerAccountList.add(fillCustomerAccount());
	}
	
	public static CustomerAccount fillCustomerAccount(/*aca falta ver que param se necesita*/) {
		CustomerAccount customerAccount = new CustomerAccount();
		customerAccount.setMRID(_NULL_STRING_); // required
		return customerAccount;
	}

	public static void fillCustomerAgreementList(List<CustomerAgreement> customerAgreementList) {
		// TODO iterar sobre una lista de CustomerAgreements
		customerAgreementList.add(fillCustomerAgreement());
	}
	
	public static CustomerAgreement fillCustomerAgreement(/*aca falta ver que param se necesita*/) {
		CustomerAgreement customerAgreement = new CustomerAgreement();
		customerAgreement.setMRID(_NULL_STRING_); // required
		return customerAgreement;
	}

	public static void fillEndDeviceAssetList(List<EndDeviceAsset> endDeviceAssetList) {
		// TODO iterar sobre una lista de EndDeviceAsset
		endDeviceAssetList.add(fillEndDeviceAsset());
	}
	
	public static EndDeviceAsset fillEndDeviceAsset(/*aca falta ver que param se necesita*/) {
		EndDeviceAsset endDeviceAsset = new EndDeviceAsset();
		endDeviceAsset.setMRID(_NULL_STRING_); // required
		return endDeviceAsset;
	}

	public static void fillEndDeviceGroupList(List<EndDeviceGroup> endDeviceGroupList) {
		// TODO iterar sobre una lista de EndDeviceGroup
		endDeviceGroupList.add(fillEndDeviceGroup());
	}
	
	public static EndDeviceGroup fillEndDeviceGroup(/*aca falta ver que param se necesita*/) {
		EndDeviceGroup endDeviceGroup = new EndDeviceGroup();
		endDeviceGroup.setGroupAddress(NumberUtil._NULL_BIGINTEGER_); // required
		return endDeviceGroup;
	}
	
	public static void fillReadingTypeList(List<ReadingType> readingTypeList) {
		// TODO iterar sobre una lista de ReadingType
		readingTypeList.add(fillReadingType());
	}
	
	public static ReadingType fillReadingType(/*aca falta ver que param se necesita*/) {
		ReadingType readingType = new ReadingType();
		readingType.setMRID(_NULL_STRING_); // required
		readingType.setName(_NULL_STRING_);
		return readingType;
	}
	
	public static void fillTimeScheduleList(List<TimeSchedule> timeScheduleList) {
		// TODO iterar sobre una lista de TimeSchedule
		timeScheduleList.add(fillTimeSchedule());
	}
	
	public static TimeSchedule fillTimeSchedule(/*aca falta ver que param se necesita*/) {
		TimeSchedule timeSchedule = new TimeSchedule();
		
		timeSchedule.setDisabled(_NULL_BOOLEAN_);
		timeSchedule.setOffset(NumberUtil._NULL_FLOAT_);
		timeSchedule.setRecurrencePattern(_NULL_STRING_);
		timeSchedule.setRecurrencePeriod(NumberUtil._NULL_FLOAT_);
		timeSchedule.setScheduleInterval(fillScheduleInterval()); // required
		
		fillTimePointsList(timeSchedule.getTimePoints());
		
		return timeSchedule;
	}
	
	public static void fillTimePointsList(List<TimePoints> timePointsList) {
		// TODO iterar sobre una lista de TimePoints
		timePointsList.add(fillTimePoints());
	}
	
	public static TimePoints fillTimePoints(/*aca falta ver que param se necesita*/) {
		TimePoints timePoints = new TimePoints();

		timePoints.setAbsolutTime(DateUtil._NULL_DATE_);
		timePoints.setRelativeTimeinterval(NumberUtil._NULL_FLOAT_);
		timePoints.setSequenceNumber(NumberUtil._NULL_BIGINTEGER_);
		timePoints.setWindow(fillWindow());
		
		return timePoints;
	}
	
	public static TimeSchedule.ScheduleInterval fillScheduleInterval(/*aca falta ver que param se necesita*/) {
		TimeSchedule.ScheduleInterval scheduleInterval = new TimeSchedule.ScheduleInterval();
		scheduleInterval.setEnd(DateUtil._NULL_DATE_); // required
		scheduleInterval.setStart(DateUtil._NULL_DATE_); // required
		return scheduleInterval;
	}
	
	public static TimeSchedule.TimePoints.Window fillWindow(/*aca falta ver que param se necesita*/) {
		TimeSchedule.TimePoints.Window window = new TimeSchedule.TimePoints.Window();
		window.setEnd(DateUtil._NULL_DATE_); // required
		window.setStart(DateUtil._NULL_DATE_); // required
		return window;
	}
}
